﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using PhotoMgr.src.gui;
using popLib;
using PhotoMgr.src.database;
using PhotoMgr.src.gui.category;
using System.IO;
using PhotoMgr.src.gui.photo;
using PhotoMgr.src.gui.contest;
using PhotoMgr.src.common;

namespace PhotoMgr
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //args = new string[] { "", "" };

            //Tam dung -> stop timer (both), hide button in host
            //tiep tuc -> continue timer
            //finish ROUND -> kiem tra ok -> hide nut cham lai

            //Application.Run(MainForm.Instance);
            //Application.Run(new FinishRoundForm(1,1));
            //Application.Run(new HostForm2(1)));            
            //Application.Run(new HostForm2());
            //return;

            try
            {
                if( args.Length == 0 )
                    Application.Run(new ContestForm());
                else if (args.Length == 1)                
                    Application.Run(new MarkerForm());
                else
                {
                    Login loginForm = new Login();
                    Application.Run(loginForm);

                    if (loginForm.DialogResult == DialogResult.OK)
                    {
                        Application.Run(MainForm.Instance);
                    }
                }
            }
            catch (Exception ex)
            {
                FormLib.alert("Có một số lỗi xảy ra!!\r\nXin vui lòng thông báo admin\r\n\r\nChi tiết lỗi: " + ex.Message, "Thông báo");
                Global.WriteLog(ex, "Program.cs");
            }
        }
    }
}
